package com.mikao.controller.goods;

import com.mikao.dto.bo.ReqDataTableDto;
import com.mikao.dto.bo.TreePriceForm;
import com.mikao.dto.vo.RspDataTableDto;
import com.mikao.entity.OfferPrice;
import com.mikao.service.OfferPriceService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Scope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author kenny
 */
@Slf4j
@RestController
@RequestMapping("/management")
@Scope("prototype")
public class OfferPriceController {

    private OfferPriceService offerPriceService;

    public OfferPriceController(OfferPriceService offerPriceService) {
        this.offerPriceService = offerPriceService;
    }

    @GetMapping("/offerPriceList")
    public RspDataTableDto<OfferPrice> offerPriceList(ReqDataTableDto reqDataTableDto) {
        return offerPriceService.offerPriceList(reqDataTableDto);
    }

    @PostMapping("/changePrice")
    public void changePrice(TreePriceForm treePriceForm) {
        offerPriceService.changePrice(treePriceForm);
    }
}
